
using RegHelper;
using System;
using System.Threading;
using Microsoft.Win32;


namespace RegTestApp
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var param = new Param(RootRegistryPath.CurrentUser, "Hello\\World\\And\\Kobi", RegistryValueKind.String);
            Console.WriteLine("valid: " + param.Valid);
            Console.WriteLine("exists: " + param.Exist());
            bool res = param.SetValue("Lurie");
            Console.WriteLine("set value ok?: " + res);
            object val;
            bool valres = param.TryGetValue(out val);
            Console.WriteLine("result: " + valres + ":::" + (string)val);
            bool delres = param.Delete();
            Console.WriteLine("deleted ok?" + delres);

            param.Dispose();

            var param2 = new Param(RootRegistryPath.CurrentUser, "Names\\Name", RegistryValueKind.String);
            var path = param2.InFolder();
            Console.WriteLine(String.Join(" -- \r\n", path.ls()));
            param2.Dispose();

            var helloworld = RegPath.NewPath(RootRegistryPath.CurrentUser, "Hello\\World", true);
            Console.WriteLine(helloworld.Handler.Name);
            var hello = helloworld.Parent();
            Console.WriteLine(hello.Handler.Name);
            var root = hello.Parent().Parent().Parent();
            Console.WriteLine(root.Handler.Name);

            Console.WriteLine("root exists"+root.Exist());

            helloworld.Dispose();
            hello.Dispose();
            root.Dispose();
        }
    }
}